<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>

    <script>
        //日期对象Date()

        // // var d = new Date();
        var d = new Date(1996, 7, 13, 15, 14, 33)
            // console.log(d.getMonth())
            // console.log(d)
            //获取年份

        // padStart()属于字符串
        var year = d.getFullYear();
        //获取月
        var month = d.getMonth().toString().padStart(2, '0');
        //获取日
        var days = d.getDate().toString().padStart(2, '0');
        //获取小时
        var hour = d.getHours().toString().padStart(2, '0');
        //获取分钟
        var minute = d.getMinutes().toString().padStart(2, '0');
        //获取秒数
        var second = d.getSeconds().toString().padStart(2, '0');

        //获取星期
        var week = d.getDay();

        var weeks = ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六']

        console.log(year + "-" + month + "-" + days + " " + hour + ":" + minute + ":" + second + "   " + weeks[week])
    </script>
</body>

</html>